package com.example.mapper.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class MyWebAppConfigurer extends WebMvcConfigurerAdapter{

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        System.out.println("addCorsMappings ----------");
        registry.addMapping("/**")
                .allowedOrigins("http://192.168.11.61:8081")
                .allowedHeaders("cache-control,content-type,hash-referer,x-requested-with")
                .allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE")
                .allowCredentials(true).maxAge(3600);
    }

}
